<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class masterreel extends CI_Controller 
	{
		public function worklist()
		{
			echo  $this->masterreel_model->getWorklist();
		}
		public function getDataMasterReel()
			{
				$inputData = array(
								"form_id"=>"1",
								"type_product"=>$this->input->post("masterMR1"),							
								"type_of"=>$this->input->post("masterMR2"),
								"gram"=>$this->input->post("masterMR4"),
								"grade"=>$this->input->post("masterMR5"),
								"key_date"=>$this->input->post("masterMR3"),
								"gram"=>$this->input->post("masterMR4"),
								"grade"=>$this->input->post("masterMR5"),
							    "shift"=> $this->input->post("masterMR6"),
								"reel_no"=> $this->input->post("masterMR7"),
								"comment"=> $this->input->post("masterMR8")
							);
				$text = "";
			 	$inputAllData=array();
			 	for($i=10;$i<=73;$i++){
			 		$data= array();
			 		//$text = $text." $i ".$this->input->post("masterMR".$i."_1")." ". $this->input->post("masterMR".$i."_2")."\n";
			 		$data = array(
			 						"data_name"=> "masterMR".$i,
			 						"data_value"=> $this->input->post("masterMR".$i."_1")
			 						//"value_end"=> $this->input->post("masterMR".$i."_2")
			 					);
			 		$inputAllData[]=$data;
			 	}
				 print_r( $this->masterreel_model->keyInMasterReel($inputData,$inputAllData));
				//echo $this->input->post("input1")." ".$this->input->post("input2")." ".$this->input->post("input3")." ".$this->input->post("input4");
				
			}
			public function newDataMasterReel()
			{
			 	$inputData = array(
								"form_id"=>"1",
								"type_product"	=>$this->input->post("masterMR1"),
								"type_of"		=>$this->input->post("masterMR3"),
								"gram"			=>$this->input->post("masterMR4"),
								//"gram"			=>$this->input->post("masterMR4"),
								"grade"			=>$this->input->post("masterMR5"),
								"shift"			=>$this->input->post("masterMR6"),
								"start_date"	=>$this->input->post("masterMR7"),
								"end_date"		=>$this->input->post("masterMR8"),						 
								//"modify_date"	=>date("Y-m-d H:i:s"),
								"modify_user"		=> $this->session->userdata('user_id'),
								"status"		=> '1'
				);
			 	$text = ""; 
			 	$inputAllData=array();
			 	for($i=10;$i<=73;$i++){
			 		$data= array();
			 		//$text = $text." $i ".$this->input->post("masterMR".$i."_1")." ". $this->input->post("masterMR".$i."_2")."\n";
			 		$data = array(
			 						"data_name"=> "masterMR".$i,
			 						"value_start"=> $this->input->post("masterMR".$i."_1"),
			 						"value_end"=> $this->input->post("masterMR".$i."_2")
			 					);
			 		$inputAllData[]=$data;
			 	}
			 	//print_r($inputAllData);
				   echo $this->masterreel_model->checkMasterReel($inputData,$inputAllData );
				//echo $this->input->post("input1")." ".$this->input->post("input2")." ".$this->input->post("input3")." ".$this->input->post("input4");
			
			}
		public function detail_masterreel()
		{
			$t_id = $this->uri->segment(3);
			$data['rs1']=$this->masterreel_model->detail_masterreel1($t_id);
			$data['rs2']=$this->masterreel_model->detail_masterreel2($t_id);
			//print_r ($data['rs']);
			$this->load->view('template/template');
			$this->load->view("detail/MasterReel",$data);
			$this->load->view('template/footer');
		}
	}
